/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package demo1012;

import java.awt.Point;
import javax.swing.JOptionPane;



/**
 *
 * @author Administrator
 */
public class ExceptionDemo3 {
   public static void main(String args[]){
    String s1=JOptionPane.showInputDialog("input number");//"123"
    String s2=JOptionPane.showInputDialog("input number");//"456"
    int div=0;
       try{
       int x1=Integer.parseInt(s1);
       int x2=Integer.parseInt(s2);
       div=x1/x2;
       }catch(NumberFormatException e){
           //System.out.println(e.getMessage());
           System.out.println("数字格式有问题");
           return;
       }
       catch(ArithmeticException e){
          // System.out.println(e.getMessage());
           System.out.println("除数为0");
           return;
       }
       JOptionPane.showMessageDialog(null, div);
   }

}
